package com.inforich.screenData.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.inforich.common.utils.DateUtils;
import com.inforich.screenData.domain.ReportView;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.inforich.screenData.mapper.ReportProjectComTransportMapper;
import com.inforich.screenData.domain.ReportProjectComTransport;
import com.inforich.screenData.service.IReportProjectComTransportService;

/**
 * 项目公司运输日汇总Service业务层处理
 *
 * @author hjm
 * @date 2022-10-27
 */
@Service
public class ReportProjectComTransportServiceImpl extends
    ServiceImpl<ReportProjectComTransportMapper, ReportProjectComTransport> implements
    IReportProjectComTransportService {

  @Override
  public Page<ReportProjectComTransport> pageReportProjectComTransport(
      Page<ReportProjectComTransport> page, Map<String, Object> map) {
    return baseMapper.pageReportProjectComTransport(page, map);
  }

  @Override
  public List<ReportProjectComTransport> listReportProjectComTransport(Map<String, Object> map) {
    return baseMapper.listReportProjectComTransport(map);
  }

  @Override
  public Boolean checkConflict(ReportProjectComTransport reportProjectComTransport) {
    return this.count(new LambdaQueryWrapper<ReportProjectComTransport>()
        .eq(ReportProjectComTransport::getStatisticsDate,
            DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD,
                reportProjectComTransport.getStatisticsDate()))
        .ne(reportProjectComTransport.getId() != null, ReportProjectComTransport::getId,
            reportProjectComTransport.getId())) > 0;
  }


}
